<?php include "../public/header.php";?>
<?php include "../public/header_public.php";?>
<link rel='stylesheet' href='/static/admin/css/home.css'>
<style>
    .xm-label-block{border: unset!important;}
    .xm-label-block span{font-size: 18px!important;}
    .xm-icon-close{display: none!important;}
    .leftcert .caitong .caibox:hover{background: #f6f6f6 !important;}
</style>
<body id="homePage">
<div id="homeBox">
    <div class="minbox" style="margin-bottom: 10px;padding-top: 10px;height: 40px;">
        <div id="chanid" class="xmselect_div" style="width: 300px;height: 40px;margin-left: 20px"></div>
    </div>
    <div class="leftcert">
        <div class="caitong">
            <div class="caibox"><div class="tit">持证人员</div><div class="con colorlan" id="person_num"></div></div>
            <div class="caibox"><div class="tit">在用人员</div><div class="con colorlan" id="use_person_num"></div></div>
            <div class="caibox"><div class="tit">空闲人员</div><div class="con colorlan" id="free_person_num"></div></div>
            <div class="caibox"><div class="tit">证书总数</div><div class="con colorlan" id="cert_num"></div></div>
            <div class="caibox"><div class="tit">证书借出</div><div class="con colorlan" id="cert_bor_num"></div></div>
            <div class="caibox"><div class="tit">投标在用</div><div class="con colorlan" id="cert_bid_num"></div></div>
            <div class="caibox"><div class="tit">报建在用</div><div class="con colorlan" id="cert_bao_num"></div></div>
            <div class="caibox"><div class="tit">报建在用(锁证)</div><div class="con colorlan" id="cert_suo_num"></div></div>
            <div class="caibox"><div class="tit">空闲证书</div><div class="con colorlan" id="cert_free_num"></div></div>
        </div>
        <div class="clear"></div>
        <div class="tabbox float-l">
            <div class="mintab">
                <div class="tits"><b>借证申请待处理</b> <span class="nums" id="borrow_num">（0）</span></div>
            </div>
            <div class="tablist" id="borrowDiv">
                <div class="hang hangxian">
                    <div class="cs cs1">申请人</div>
                    <div class="cs cs2">申请部门</div>
                    <div class="cs cs3">用途</div>
                    <div class="cs cs4">申请时间</div>
                    <div class="cs cs5">状态</div>
                    <div class="clear"></div>
                </div>
                <div class="conss"><div class="nodata"><img src="/static/admin/images/welnodata.png" alt=""><div>暂无数据</div></div></div>
            </div>
        </div>
        <div class="tabbox float-r" style="width: calc(50% - 25px);">
            <div class="mintab">
                <div class="tits"><b>逾期未归还证书</b> <span class="nums" id="borlist_num">（0）</span></div>
            </div>
            <div class="tablist" id="borlistDiv">
                <div class="hang hangxian">
                    <div class="cs cs1">证书名称</div>
                    <div class="cs cs2">借证人</div>
                    <div class="cs cs3">借出日期</div>
                    <div class="cs cs4">预计归还日期</div>
                    <div class="cs cs5">逾期天数</div>
                    <div class="clear"></div>
                </div>
                <div class="conss"><div class="nodata"><img src="/static/admin/images/welnodata.png" alt=""><div>暂无数据</div></div></div>
            </div>
        </div>

        <div class="tabbox float-l">
            <div class="mintab">
                <div class="tits"><b>投标用证待处理</b> <span class="nums" id="biduse_num">（0）</span></div>
            </div>
            <div class="tablist" id="biduseDiv">
                <div class="hang hangxian">
                    <div class="cs cs1">申请人</div>
                    <div class="cs cs2">申请部门</div>
                    <div class="cs cs3">用证项目</div>
                    <div class="cs cs4">截标日期</div>
                    <div class="cs cs5">状态</div>
                    <div class="clear"></div>
                </div>
                <div class="conss"><div class="nodata"><img src="/static/admin/images/welnodata.png" alt=""><div>暂无数据</div></div></div>
            </div>
        </div>
        <div class="tabbox float-r" style="width: calc(50% - 25px);">
            <div class="mintab">
                <div class="tits"><b>报建用证待处理</b> <span class="nums" id="enginuse_num">（0）</span></div>
            </div>
            <div class="tablist" id="enginuseDiv">
                <div class="hang hangxian">
                    <div class="cs cs1">申请人</div>
                    <div class="cs cs2">申请部门</div>
                    <div class="cs cs3">用证项目</div>
                    <div class="cs cs4">报建日期</div>
                    <div class="cs cs5">状态</div>
                    <div class="clear"></div>
                </div>
                <div class="conss"><div class="nodata"><img src="/static/admin/images/welnodata.png" alt=""><div>暂无数据</div></div></div>
            </div>
        </div>
    </div>


    <div class="rightengin" style="height: 734px">
        <div class="tits"><b>即将到期证书</b></div>
        <input type="hidden" id="checkchanid">
        <div class="chadt">
            <div class="layui-tab layui-tab-brief">
                <ul class="layui-tab-title">
                    <li class="layui-this">最近30天</li>
                    <li>最近60天</li>
                    <li>最近90天</li>
                    <li>已过期</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <div class="linecon">
                            <ul class="layui-timeline" id="dongList3"></ul>
                        </div>
                    </div>
                    <div class="layui-tab-item">
                        <div class="linecon">
                            <ul class="layui-timeline" id="dongList6"></ul>
                        </div>
                    </div>
                    <div class="layui-tab-item">
                        <div class="linecon">
                            <ul class="layui-timeline" id="dongList9"></ul>
                        </div>
                    </div>
                    <div class="layui-tab-item">
                        <div class="linecon">
                            <ul class="layui-timeline" id="dongList1"></ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $('.tablist').on('mouseover','.conss .hang',function () {
        $(this).addClass('colorlan');
    }).on('mouseout','.conss .hang',function () {
        $(this).removeClass('colorlan');
    });
    $('#dongList3,#dongList6,#dongList9,#dongList1').on('mouseover','p',function () {
        $(this).addClass('colorlan');
    }).on('mouseout','p',function () {
        $(this).removeClass('colorlan');
    });

    layui.use(['form', 'layer', "laytp",'element','dropdown'], function() {
        var form = layui.form, element = layui.element;
        get_cert_chan_home();

        function get_cert_chan_home(chanid=0){
            facade.ajax({url: ask_cert_chan_home, data:{chanid:chanid}}).done(function(res){
                if (res.code === 2000) {
                    var data = res.data;
                    $("#person_num").html(data.person_num);
                    $("#use_person_num").html(data.use_person_num);
                    $("#free_person_num").html(data.free_person_num);
                    $("#cert_num").html(data.cert_num);
                    $("#cert_bor_num").html(data.cert_bor_num);
                    $("#cert_bid_num").html(data.cert_bid_num);
                    $("#cert_bao_num").html(data.cert_bao_num);
                    $("#cert_suo_num").html(data.cert_suo_num);
                    $("#cert_free_num").html(data.cert_free_num);


                    $("#checkchanid").text(res.data.is_chanid);
                    xmselect_dan('chanid', res.data.chanid, res.data.is_chanid, function (res) {
                        $('#checkchanid').val(res.change[0].id);
                        get_cert_chan_home(res.change[0].id)
                    });


                    var borrow_data = res.data.borrow_data;
                    if(borrow_data.length > 0){
                        var borrow_data_str = '';
                        for (var key in borrow_data){
                            borrow_data_str += '<div class="hang">';
                            borrow_data_str += '<div class="cs cs1">'+borrow_data[key].flowuser+'</div>';
                            borrow_data_str += '<div class="cs cs2">'+borrow_data[key].flowdept+'</div>';
                            borrow_data_str += '<div class="cs cs3">'+borrow_data[key].yong+'</div>';
                            borrow_data_str += '<div class="cs cs4">'+borrow_data[key].created_at+'</div>';
                            borrow_data_str += '<div class="cs cs5">申请中</div>';
                            borrow_data_str += '<div class="clear"></div>';
                            borrow_data_str += '</div>';
                        }
                        $("#borrowDiv .conss").html(borrow_data_str);
                    }
                    $("#borrow_num").html('('+data.borrow_num+')');


                    var borlist_data = res.data.borlist_data;
                    if(borlist_data.length > 0){
                        var borlist_data_str = '';
                        for (var key in borlist_data){
                            borlist_data_str += '<div class="hang">';
                            borlist_data_str += '<div class="cs cs1 colorlan">'+borlist_data[key].cert_name+'</div>';
                            borlist_data_str += '<div class="cs cs2">'+borlist_data[key].flowuser+'</div>';
                            borlist_data_str += '<div class="cs cs3">'+borlist_data[key].qudt+'</div>';
                            borlist_data_str += '<div class="cs cs4">'+borlist_data[key].yudt+'</div>';
                            borlist_data_str += '<div class="cs cs5">'+borlist_data[key].day+'</div>';
                            borlist_data_str += '<div class="clear"></div>';
                            borlist_data_str += '</div>';
                        }
                        $("#borlistDiv .conss").html(borlist_data_str);
                    }
                    $("#borlist_num").html('('+data.borlist_num+')');


                    var biduse_data = res.data.biduse_data;
                    if(biduse_data.length > 0){
                        var biduse_data_str = '';
                        for (var key in biduse_data){
                            biduse_data_str += '<div class="hang">';
                            biduse_data_str += '<div class="cs cs1">'+biduse_data[key].flowuser+'</div>';
                            biduse_data_str += '<div class="cs cs2">'+biduse_data[key].flowdept+'</div>';
                            biduse_data_str += '<div class="cs cs3">'+biduse_data[key].name+'</div>';
                            biduse_data_str += '<div class="cs cs4">'+biduse_data[key].dt+'</div>';
                            biduse_data_str += '<div class="cs cs5">申请中</div>';
                            biduse_data_str += '<div class="clear"></div>';
                            biduse_data_str += '</div>';
                        }
                        $("#biduseDiv .conss").html(biduse_data_str);
                    }
                    $("#biduse_num").html('('+data.biduse_num+')');



                    var enginuse_data = res.data.enginuse_data;
                    if(enginuse_data.length > 0){
                        var enginuse_data_str = '';
                        for (var key in enginuse_data){
                            enginuse_data_str += '<div class="hang">';
                            enginuse_data_str += '<div class="cs cs1">'+enginuse_data[key].flowuser+'</div>';
                            enginuse_data_str += '<div class="cs cs2">'+enginuse_data[key].flowdept+'</div>';
                            enginuse_data_str += '<div class="cs cs3">'+enginuse_data[key].name+'</div>';
                            enginuse_data_str += '<div class="cs cs4">'+enginuse_data[key].dt+'</div>';
                            enginuse_data_str += '<div class="cs cs5">申请中</div>';
                            enginuse_data_str += '<div class="clear"></div>';
                            enginuse_data_str += '</div>';
                        }
                        $("#enginuseDiv .conss").html(enginuse_data_str);
                    }
                    $("#enginuse_num").html('('+data.enginuse_num+')');


                    get_cert_dong_home();
                    render_from();
                }
            });
        }


        function get_cert_dong_home(){
            var chanid = $("#checkchanid").val();
            facade.ajax({url: ask_cert_dong_home, data:{chanid:chanid}}).done(function(res){
                if (res.code === 2000) {
                    var list3 = res.data.list3;
                    var list6 = res.data.list6;
                    var list9 = res.data.list9;
                    var list1 = res.data.list1;

                    var str3 = '';
                    for (var key in list3){
                        str3 += '<li class="layui-timeline-item">';
                        str3 += '<i class="layui-icon layui-timeline-axis">&#xe643;</i>';
                        str3 += '<div class="layui-timeline-content layui-text">';
                        str3 += '<div class="layui-timeline-title" style="font-size: 14px!important;">';
                        str3 += key;
                        str3 += '</div>';
                        for(var i=0;i<list3[key].length;i++){
                            str3 += '<p>'+list3[key][i]+'</p>';
                        }
                        str3 += '</div>';
                        str3 += '</li>';
                    }
                    if(str3 === ''){
                        str3 += '<div class="nodata"><img src="/static/admin/images/welnodata.png" alt=""><div>暂无数据</div></div>';
                    }
                    $("#dongList3").html(str3);


                    var str6 = '';
                    for (var key in list6){
                        str6 += '<li class="layui-timeline-item">';
                        str6 += '<i class="layui-icon layui-timeline-axis">&#xe643;</i>';
                        str6 += '<div class="layui-timeline-content layui-text">';
                        str6 += '<div class="layui-timeline-title" style="font-size: 14px!important;">';
                        str6 += key;
                        str6 += '</div>';
                        for(var i=0;i<list6[key].length;i++){
                            str6 += '<p>'+list6[key][i]+'</p>';
                        }
                        str6 += '</div>';
                        str6 += '</li>';
                    }
                    if(str6 === ''){
                        str6 += '<div class="nodata"><img src="/static/admin/images/welnodata.png" alt=""><div>暂无数据</div></div>';
                    }
                    $("#dongList6").html(str6);

                    var str9 = '';
                    for (var key in list9){
                        str9 += '<li class="layui-timeline-item">';
                        str9 += '<i class="layui-icon layui-timeline-axis">&#xe643;</i>';
                        str9 += '<div class="layui-timeline-content layui-text">';
                        str9 += '<div class="layui-timeline-title" style="font-size: 14px!important;">';
                        str9 += key;
                        str9 += '</div>';
                        for(var i=0;i<list9[key].length;i++){
                            str9 += '<p>'+list9[key][i]+'</p>';
                        }
                        str9 += '</div>';
                        str9 += '</li>';
                    }
                    if(str9 === ''){
                        str9 += '<div class="nodata"><img src="/static/admin/images/welnodata.png" alt=""><div>暂无数据</div></div>';
                    }
                    $("#dongList9").html(str9);

                    var str1 = '';
                    for (var key in list1){
                        str1 += '<li class="layui-timeline-item">';
                        str1 += '<i class="layui-icon layui-timeline-axis">&#xe643;</i>';
                        str1 += '<div class="layui-timeline-content layui-text">';
                        str1 += '<div class="layui-timeline-title" style="font-size: 14px!important;">';
                        str1 += key;
                        str1 += '</div>';
                        for(var i=0;i<list1[key].length;i++){
                            str1 += '<p>'+list1[key][i]+'</p>';
                        }
                        str1 += '</div>';
                        str1 += '</li>';
                    }
                    if(str1 === ''){
                        str1 += '<div class="nodata"><img src="/static/admin/images/welnodata.png" alt=""><div>暂无数据</div></div>';
                    }
                    $("#dongList1").html(str1);
                    render_from();
                }
            });
        }


    });
</script>
</body>
</html>
